package com.sd.jdbc;
import java.sql.*;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.PreparedStatement;

public class Timecalculate {

	public static void main(String[] args) throws Exception{
		//registering the driver
			//Class.forName("oracle.jdbc.oracle.OracleDriver");
		DriverManager.registerDriver(new oracle.jdbc.driver.OracleDriver());
			System.out.println("driver registered");
			//Established connection
			Connection conn=DriverManager.getConnection("jdbc:oracle:thin:@localhost:1521:XE","system","tiger");
			System.out.println("connection Established");
			//create prepared statement
			PreparedStatement ps=conn.prepareStatement("insert into Emp1 values(?,?)");
			System.out.println("statement prepared");
			//count time at insertion
			long t1=System.currentTimeMillis();
			for(int i=1;i<3;i++){
				ps.setInt(1,i);
				ps.setInt(2, i);
				ps.executeUpdate();
			}
			//count after insertion 
			long t2=System.currentTimeMillis();
			System.out.println("time taken after insertion" + (t2-t1));
//	ps.setInt(1,1008);


	//ps.setString(2,"aniket");


	//int i=ps.executeUpdate();
	//System.out.println(i + "records inserted");
			



			conn.close();
		}
		
		

	}

